import React, { Component } from 'react'
import { Consumer } from './context'

export default class Grandson extends Component {
  render () {
    return (
      <div>
        Grandson
        {/* Comsumer里面要写上一个表达式，表达式里面有一个箭头函数，
          通过箭头函数的形参拿到值 */}
        <Consumer>
          {value => {
            return (
              <div>
                <p>{value.money}</p>
                <button
                  onClick={() => {
                    value.callback(25000000)
                  }}
                >
                  change
                </button>
              </div>
            )
          }}
        </Consumer>
      </div>
    )
  }
}
